﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BuscaFact.aspx.cs" Inherits="CROSLAND.WebApp.BuscaFact" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<%@ Register assembly="IdeaSparx.CoolControls.Web" namespace="IdeaSparx.CoolControls.Web" tagprefix="cc2" %>

<asp:Content ID="Content6" ContentPlaceHolderID="cphMain" runat="server">

<script type="text/javascript">
    function getCodigo(source, eventArgs) {
        $get('<%= txtCodCliente.ClientID %>').value = eventArgs.get_value();
    }
</script>

<asp:UpdatePanel ID="upMain" runat="server">

        <ContentTemplate>
        <div style="height:10px"></div>

        <table cellpadding="2" cellspacing="0" class="tbl-detalle" style="width:978px; height:180px">
            <tr>
                <td>Factura SAP</td>
                <td><asp:TextBox ID="txtFactura" runat="server"></asp:TextBox></td>
            </tr>
             <tr>
                <td>Folio legal </td>
                <td><asp:TextBox ID="txtFolio" runat="server"></asp:TextBox></td>
            </tr>
             <tr>
                <td>Fecha factura</td>
                <td>
                    <asp:TextBox ID="txtFechaInicio" runat="server" Width="70" CssClass="inputbox" ReadOnly="false" AutoPostBack="false" Font-Size="10" />
                    <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFechaInicio" Format="dd/MM/yyyy" CssClass="MyCalendar" />a
                    <asp:TextBox ID="txtFechaFin" runat="server" Width="70" CssClass="inputbox" ReadOnly="false" AutoPostBack="false" Font-Size="10" />  
                    <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFechaFin" Format="dd/MM/yyyy" CssClass="MyCalendar" />&nbsp;&nbsp;
                    <asp:ImageButton ID="ibtnBuscar" runat="server" ImageAlign="Middle" ImageUrl="~/img/find.png" OnClick="ibtnBuscar_Click" />
        
                </td>
            </tr>
             <tr>
                <td>Cliente</td>
                <td><asp:TextBox ID="txtCodCliente" runat="server"></asp:TextBox></td>
                <%--
                <td>
                                        
                    <asp:TextBox ID="txtCodCliente" runat="server" CssClass="inputbox" MaxLength="10" 
                         AutoCompleteType="Company" Width="80px" AutoPostBack="True" OnTextChanged="txtCodCliente_TextChanged" />
                    <asp:FilteredTextBoxExtender ID="ftbeCodCliente" runat="server" TargetControlID="txtCodCliente" FilterType="Numbers" Enabled="True" />     
            
                    <asp:TextBox ID="txtNomCliente" runat="server" CssClass="inputbox" AutoCompleteType="Disabled" Width="200px" AutoPostBack="True" />
                    <asp:AutoCompleteExtender ID="aceNomCliente" runat="server" TargetControlID="txtNomCliente" MinimumPrefixLength="1" 
                       CompletionInterval="100" CompletionSetCount="15" CompletionListCssClass="autocomplete_completionListElement" 
                       CompletionListItemCssClass="autocomplete_listItem"
                       CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters="" ServiceMethod="buscaClientes"
                       OnClientItemSelected="getCodigo" Enabled="True" ServicePath="">
                    </asp:AutoCompleteExtender>
        
                </td>--%>
            </tr> 
            <tr>
                <td>Material</td>
                <td><asp:TextBox ID="txtMaterial" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td>Lote</td>
                <td><asp:TextBox ID="txtLote" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td>Vendedor</td>
                <td><asp:TextBox ID="txtVendedor" runat="server"></asp:TextBox></td>
            </tr>
        </table>

        <div style="height:10px"></div>
        
        <cc2:CoolGridView ID="gvListado" runat="server" AutoGenerateColumns="false" 
        CssClass="tbl-detalle" Width="978px" OnRowCommand="gvListado_RowCommand" 
        GridLines="None" ShowHeader="true" DefaultColumnWidth="937px" Height="350px" 
        AllowPaging="True" onpageindexchanged="Page_Load" 
        onpageindexchanging="gvListado_PageIndexChanging" PageSize="12" >
            <Columns>                              
                <asp:TemplateField HeaderText="" HeaderStyle-Width="20px"  ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
          <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/img/detalle.png" CommandName="Detalle" 
          CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:ImageButton>

    </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<table border="0" style="background-color:Transparent;">
    <tr>
        <th style="width:80px;">Factura</th>
        <th style="width:80px">Folio Legal</th>
        <th style="width:110px;">Fec. Factura</th>
        <th style="width:210px;">Cliente</th>
        <th style="width:70px;">Total</th>
        <th style="width:100px;">Estado Compensación</th>
        <th style="width:110px;">NIF</th>  
        <th style="width:310px;">Vendedor</th>  
        <th style="width:90px;">Condición Pago</th>
    </tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" style="background-color:Transparent; margin-left:3px;">
    <tr style="height:5px;" />
    <tr><td style="text-align:center; width:65px;"><asp:Label ID="lblNumPedido" runat="server" Text='<%# Bind("NumPedidoCorto") %>' /></td>
        <td style="text-align:center; width:65px;"><asp:Label ID="Label2" runat="server" Text='<%# Bind("folioLegal") %>' /></td>
        <td style="text-align:center; width:90px;"><asp:Label ID="Label3" runat="server" Text='<%# Bind("FechaString") %>' /></td>
        <td style="text-align:left; width:150px;"><asp:Label ID="Label4" runat="server" Text='<%# Bind("nomCliente") %>' /></td>
        <td style="width:65px;text-align:center"><asp:Label ID="Label6" runat="server" Text='<%# Bind("totalFact", "{0:0,0.00}") %>' /></td>        
        <td style="text-align:center; width:90px;"><asp:Label ID="Label5" runat="server" Text='<%# Bind("compensacion") %>' /></td>
        <td style="text-align:center; width:90px;"><asp:Label ID="Label1" runat="server" Text='<%# Bind("CodCliente") %>' /></td>
        <td style="width:250px;"><asp:Label ID="Label7" runat="server" Text='<%# Bind("Vendedor1") %>' /></td>
        <td style="width:30px;"><asp:Label ID="Label8" runat="server" Text='<%# Bind("CondPago") %>' /></td>
    </tr>
    <tr style="height:5px;" />
    <tr>
        <td colspan="7">
        <asp:GridView ID="gvDetalle" runat="server" AutoGenerateColumns="false" CssClass="tbl-detalle"
                        Width="900px" GridLines="Both" BackColor="Transparent" Visible="false" EmptyDataText="hhh" DataSource='<%# Bind("ListaReserva") %>'>
                <Columns>                     
                    <asp:BoundField DataField="posicion" HeaderText="Pos." />
                    <asp:BoundField DataField="codMaterial" HeaderText="Material" />
                    <asp:BoundField DataField="descMaterial" HeaderText="Denominación" />
                    <asp:BoundField DataField="lote" HeaderText="Lote" />
                    <asp:BoundField DataField="motor" HeaderText="Motor" />
                    <asp:BoundField DataField="vin" HeaderText="Vin" />
                    <asp:BoundField DataField="status" HeaderText="Status Venta" />
                    <asp:BoundField DataField="disponibilidad" HeaderText="Disponibilidad" />
                    <asp:BoundField DataField="emplazamiento" HeaderText="Emplazamiento" />
                    <asp:BoundField DataField="marca" HeaderText="Marca" />
                    <asp:BoundField DataField="color" HeaderText="Color" />
                    <asp:BoundField DataField="añoFab" HeaderText="Año Fab." />
                    <asp:BoundField DataField="añoModelo" HeaderText="Año Modelo" />
                    <asp:BoundField DataField="grupoArticulo" HeaderText="Grp. Art." /> 
                    <asp:BoundField DataField="pedidoSap" HeaderText="Pedido Sap" />
                </Columns>
            </asp:GridView>
        </td>
    </tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>

    <PagerSettings Mode="NumericFirstLast" />
<AlternatingRowStyle BackColor="Beige" />
    <PagerStyle Font-Size="Medium" />
<HeaderStyle BackColor="Silver" Font-Size="12px" Height="20px" />
    <BoundaryStyle BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" />
      </cc2:CoolGridView>
    </ContentTemplate>
</asp:UpdatePanel>
</asp:Content>


